// 获取资源的详情信息
// 该方式更准确
export default async function getMessage(source) {
  try {
    const { size = 0, type = "" } = await fetch(source).then((res) =>
      res.blob()
    );
    return { size, type };
  } catch (error) {
    const typeError = new TypeError();
    typeError.data = {
      code: 0,
      message: "Failed",
      data: {
        error,
      },
    };
  }
}

// getMessage(
//   "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3636058960,1338604857&fm=26&gp=0.jpg"
// ).then((ret) => {
//   console.log(ret);
// });
